#pragma once
#include "BasicFunction.h"
using namespace std;
// CTextProcess dialog

class CTextProcess : public CDialog
{
	DECLARE_DYNAMIC(CTextProcess)

public:
	CTextProcess(CWnd* pParent);   // standard constructor
	BOOL Create();

	virtual ~CTextProcess();

// Dialog Data
	enum { IDD = IDD_TEXTANALYSIS };

protected:
	virtual void	DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	virtual void	OnOK();
	virtual void	PostNcDestroy();
	afx_msg void	OnClose();
	
public:
	CWnd*	parent;
	int				dialogid;
	CBasicFunction bf;

	//Assign string to the rich edit boxes
	void		AssignStringFreeText(CString freetext);

private:
	void		AssignStringKeyterms(CString keyterms);
	void		AssignStringKeytermsForCollocation(CString keyterms);
	void		AssignStringCollocations(CString collocations);
	void		ResetAll(void);
	void		ResetCollocation(void);
	vector<string> GetWordsForCollocation(void);
	void		RemoveEnter(string& enterstring);

	string	mfreetext;													//String containing the free text for analysis
	vector<string>	mkeywords;										//Keyterms extracted from the free text
	vector<string> mkeywordsforcollocation;					//Keyterms selected for collocations
	vector<string> mcollocations;									//The collocations

	vector<unsigned int> mkeywordfrequency;				//Frequency of the keyterms
	vector<double> mkeywordweirdness;						//Weirdness of the keyterms
	vector<vector<double>> mcollocationfrequency;		//The collocation frequency
	vector<double> mcollocationspread;						//The spread of the collocations
	vector<double> mcollocationsum;							//The sum of collocations
	vector<unsigned int> mcollocationlocation;			//Locations of the words

	unsigned int	dialogselected;

	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedDowordlist();
	afx_msg void OnBnClickedDocollocation();
	afx_msg void OnBnClickedGetalltext();
	afx_msg void OnBnClickedTextprocessingAnnotateimage();
	afx_msg void OnEnSetfocusFreetext();
	afx_msg void OnEnSetfocusKeyterms();
	afx_msg void OnEnSetfocusKeytermsforcollocation();
	afx_msg void OnEnSetfocusCollocations();
	void		CloseDialog();
};
